#pragma once

#include <iostream>
#include <pthread.h>
#include<queue>

const int gcap=5;

 template<class T>
class BlockQueue
{
public:
    BlockQueue(const int cap=gcap):_cap(cap)
    {
        pthread_mutex_init(&_mutex,nullptr);
        pthread_cond_init(&_consumerCond,nullptr);
        pthread_cond_init(&_productorCond,nullptr);
    
    }
    void push(const T&in)
    {
        
    }
    void pop(T*out)
    {}
    ~BlockQueue()
    {
        pthread_mutex_destroy(&mutex);
        pthread_cond_destory(&_consumerCond);
        pthread_cond_destory(&_productorCond);

    }
private:
    std::queue<T> _q;
    int _cap;
    pthread_mutex_t _mutex;
    pthread_cond_t _consumerCond;//消费者条件变量，空，wait
    pthread_cond_t _productorCond;//生产者条件变量，满，wait

};